package com.sztz.mapstruct.G数据类型转换;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * CarMapper
 *
 * @author yyf
 * @email yeyafei@hotmail.com
 */
@Mapper
public interface CarMapper {

    CarMapper INSTANCE = Mappers.getMapper(CarMapper.class);

    /**
     * 类型转换
     *
     * @param car
     * @return CarDto
     */
    @Mappings({
            //数字转字符串
            @Mapping(source = "first", target = "first", numberFormat = "#"),
            //时间转字符串
            @Mapping(source = "third", target = "third", dateFormat = "yyyy-mm-dd"),
    })
    CarDTO toDto(Car car);
}
